﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using FluentValidation;
using CashFlow.Web.Common;
using CashFlow.Web.Areas.ShopManage.Models.User;

namespace CashFlow.Web.Areas.ShopManage.Validator.User
{
    public class QueryUserModelValidator
        : AbstractValidator<QueryUserModel>
    {
        public QueryUserModelValidator()
        {
            CascadeMode = CascadeMode.Stop;
            RuleFor(x => x.State).Must(x =>
            {
                if (x.HasValue)
                {
                    return RegExpTool.IsOrderState(x.Value);
                }
                return true;
            }).WithMessage("非法State");
        }
    }
}